<?php

include 'BaiduBce.phar';
use BaiduBce\Util\Time;
use BaiduBce\Services\Bos\BosClient;
date_default_timezone_set("Asia/Shanghai");

$BOS_TEST_CONFIG =
    array(
        'credentials' => array(
            'ak' => 'CD77199fbfb40f5fb0706c6b24e8c4a2',  //用户的AK
            'sk' => 'A5204b83b0966c50ac7727ce539cbf62',  //用户的SK
        ),
        'endpoint' => 'http://bj.bcebos.com',   //BOS HOST
    );

$bucketName = 'baedemobucket';
$targetKey = 'sampleKey.txt';


$client = new BosClient($BOS_TEST_CONFIG);
//新建一个bucket
$client->createBucket($bucketName);

//上传内容到BOS
$client->putObjectFromString($bucketName, $targetKey, "hello world");

//从BOS下载内容
$content = $client->getObjectAsString($bucketName, $targetKey);
print_r("Content from BOS:" . $content);